<template>
	<view class="page">
		<view class="list-tab">
			<wuc-tab :tab-list="tabList" :tabCur.sync="tabCur" @change="tabChange"></wuc-tab>
		</view>
		<uni-list>
			<uni-list-item v-for="item in businessList" :title="item.business_name" :key="item.cb_id" :data-id="item.cb_id"
			 :note="'更新时间:'+item.updated_at" :show-badge="true" :badge-text="item.status2" @tap="toList"></uni-list-item>
		</uni-list>
	</view>
</template>

<script>
	import uniList from "@/components/uni-list/uni-list.vue"
	import uniListItem from "@/components/uni-list-item/uni-list-item.vue"
	import wucTab from '@/components/wuc-tab/wuc-tab.vue'
	
	import { list } from '@/api/business.js'
	import '@/mock/business.js'
	
	export default {
		components: {
			uniList,
			uniListItem,
			wucTab
		},
		data() {
			return {
				tabCur: 0,
				tabList: [],
				businessList: []
			}
		},
		onLoad() {
			this.getBusinessList()
		},
		methods: {
			tabChange(e) {
				this.tabCur = e
			},
			getBusinessList(page, type) {
				list().then(res => {
					console.log(res)
					if(res.statusCode === 1) {
						this.businessList = res.result
					}
				}).catch(err => {
					console.log(err)
				})
			},
			toList(e) {
				uni.navigateTo({
					url: "detail"
				})
			}
		}
	}
</script>

<style>
</style>
